package com.woniuxy.food.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.cloud.mall95.log.Log;
import com.woniuxy.food.client.foodpropvalueclient.FoodPropValueQueryClient;
import com.woniuxy.food.client.result.ClientFoodPropDto;
import com.woniuxy.food.client.result.FoodPropValueClientDto;
import com.woniuxy.food.service.FoodPropValueService;
import com.woniuxy.food.service.servicedto.FoodPropValueServiceDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

import java.util.List;

@RestController
public class FoodPropValueQueryClientApiImpl implements FoodPropValueQueryClient {
    @Autowired
    private FoodPropValueService foodPropValueService;
    @Override
    @Log("根据菜品属性ID查询全部属性值")
    public Result<List<FoodPropValueClientDto>> searchFoodPropValueByFoodPropId(Integer storeId, Integer foodPropId) {
        List<FoodPropValueServiceDto> foodPropValueServiceDtos = foodPropValueService.searchFoodPropValueByFoodPropId(storeId, foodPropId);
        List<FoodPropValueClientDto> foodPropValueClientDtos = BeanUtil.copyToList(foodPropValueServiceDtos, FoodPropValueClientDto.class);
        return Result.success(foodPropValueClientDtos);
    }
}
